package com.example.common.i18n.api;

import com.example.common.i18n.util.MessageUtils;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.LinkedHashMap;

@ToString
public class AjaxJson <T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private static final int SUCCESS = 0;
    private static final int FAIL = 1;
    @Getter
    @Setter
    private String msg = "success";

    @Getter
    @Setter
    private int code = SUCCESS;

    @Getter
    @Setter
    private T data;

    private LinkedHashMap<String, Object> extend = new LinkedHashMap<String, Object>();// 扩展数据
    public void setExtend(LinkedHashMap<String, Object> extend) {
        this.extend = extend;
    }
    public LinkedHashMap<String, Object> getExtend() {
        return extend;
    }
    public void put(String key, Object value) {
        extend.put(key, value);
    }
    public void remove(String key) {
        extend.remove(key);
    }

    public AjaxJson() {
    }

    public AjaxJson(String msg, int code, T data) {
        this.msg = msg;
        this.code = code;
        this.data = data;
    }



}
